@model OurWedding1.Models.Installment
@using OurWedding1

@{
    ViewBag.Title = @Resources.Installment + " - " + @Resources.Edit;
}

<h2>@ViewBag.Title</h2>

@using (Html.BeginForm())
{
    @Html.ValidationSummary(true)
    <fieldset>
        <legend>@Resources.Installment</legend>

        @Html.HiddenFor(model => model.InstallmentId)
        @Html.Partial("_CreateOrEdit", Model)

        <p>
            <input type="submit" value="@Resources.Save" />
        </p>
    </fieldset>
}

<div>
    @Html.ActionLink(@Resources.Back_To_List, "Index")
</div>

@section Scripts {
    @Scripts.Render("~/bundles/jqueryval")
    @Scripts.Render("~/bundles/autonumeric")
     @Scripts.Render("~/bundles/jqueryglob")
    <script type="text/javascript">

        $(document).ready(function () {
            if (!Modernizr.inputtypes.date) {
                $('input[type=date]').datepicker();
            }

            Globalize.culture("pl-PL");
            //Tell the validator that we want numbers parsed using Globalize.js
            $.validator.methods.number = function (value, element) {
                var val = Globalize.parseFloat(value);
                return this.optional(element) || ($.isNumeric(val));
            };

            //Tell the validator that we want dates parsed using Globalize.js
            $.validator.methods.date = function (value, element) {
                var val = Globalize.parseDate(value, "dd MMM yyyy") || Globalize.parseDate(value); //Try using custom format, fall back to default
                return this.optional(element) || (val);
            };

            //Fix the range to use globalized methods
            $.extend(jQuery.validator.methods, {
                range: function (value, element, param) {
                    var val = Globalize.parseFloat(value);
                    return this.optional(element) || (val >= param[0] && val <= param[1]);
                }
            });
        });

    </script>


}